﻿@{
    if (RequestHelper.QueryString("use") != "include")
    {
        ViewBag.Title = "标签";
        Layout = "~/Views/Shared/_Admin.cshtml";
    }
    var tags = ViewData.Model as IList<Term> ??new List<Term>();
}
<link type="text/css" href="/content/styles/posts.css?var=1.0" rel="stylesheet" />
<div class="hd-title">
    <h1 class="post">标签</h1>
</div>
<div id="message" class="alert">
    <button type="button" class="close" data-dismiss="alert">×</button>
    <span></span>
</div>
<div class="input-append">
    <label for="txt_search" class="hide-text">搜索类别</label>
    <input id="txt_search" class="search-term" type="text">
    <button class="btn btn-small" type="button">搜索</button>
</div>
<b class="clearfix"></b>
<div class="row-fluid">
    <div class="span4 insert-term">
        <h3 id="act_name">添加新标签</h3>
        <br />
        <label for="term_name">名称</label>
        <input id="term_name" type="text" />
        <p class="muted">
            这将是它在站点上显示的名字。
        </p>
        <label for="term_slug">别名</label>
        <input id="term_slug" type="text" />
        <p class="muted">
            “别名”是在 URL 中使用的别称，它可以令 URL 更美观。通常使用小写，只能包含字母，数字和连字符（-）。
        </p>
        <input id="term_parent" type="hidden" value="-1"/>
        <label for="term_description">描述</label>
        <textarea id="term_description" rows="3" cols="30"></textarea>
        <p class="muted">
            描述只会在一部分主题中显示。
        </p>
        <p class="submit">
            <input id="term_id" type="hidden" value="0" />
            <input id="term_type" type="hidden" value="0" />
            <input id="btn_term" class="btn btn-primary btn-small" value="保存标签">
        </p>
    </div>
    <div class="span8 term-list">
        <div class="row-fluid">
            <select id="handle_top" class="sel-action">
                <option value="-1" selected="selected">批量操作</option>
                <option value="edit">编辑</option>
                <option value="delete">删除</option>
            </select>
            <a class="do-action btn btn-mini" href="javascript:;">应用</a>
            <a id="add_term" class="btn btn-mini" href="javascript:;">添加</a>
        </div>
        <table class="table widefat table-hover table-striped">
            <thead>
                <tr>
                    <th class="col-cb">
                        <label for="cb_all_top" class="hide-text">全选</label>
                        <input id="cb_all_top" class="cb-all" type="checkbox" />
                    </th>
                    <th class="col-name">名称</th>
                    <th class="col-description">描述</th>
                    <th class="col-slug">别名</th>
                    <th class="col-post">文章</th>
                    <th class="col-action text-center"><i class="icon-edit"></i></th>
                </tr>
            </thead>
            <tbody id="term_list">
                @foreach (var item in tags)
                {
                    <tr id="term_@item.Id" data-parent-id="@item.ParentId">
                        <td class="col-cb">
                            <label for="cb_term_@item.Id" class="hide-text">选择 @item.Name</label>
                            <input id="cb_term_@item.Id" class="cb-item" type="checkbox" />
                        </td>
                        <td class="col-name"><a id="edit_term_@item.Id" class="edit-term" href="javascript:;">@item.Name</a></td>
                        <td class="col-description">@item.Description</td>
                        <td class="col-slug">@item.Slug</td>
                        <td class="col-post">@item.Count</td>
                        <td class="col-action delete-term close" data-dismiss="alert" data-term-id="@item.Id">×</td>
                    </tr>
                }
            </tbody>
            <tfoot>
                <tr>
                    <th class="col-cb">
                        <label for="cb_all_bottom" class="hide-text">全选</label>
                        <input id="cb_all_bottom" class="cb-all" type="checkbox" />
                    </th>
                    <th class="col-name">名称</th>
                    <th class="col-description">描述</th>
                    <th class="col-slug">别名</th>
                    <th class="col-post">文章</th>
                    <th class="col-action text-center"><i class="icon-edit"></i></th>
                </tr>
            </tfoot>
        </table>
        <div class="row-fluid">
            <select id="handle_bottom" class="sel-action">
                <option value="-1" selected="selected">批量操作</option>
                <option value="edit">编辑</option>
                <option value="delete">删除</option>
            </select>
            <a class="do-action btn btn-mini" href="javascript:;">应用</a>
        </div>
        <p class="muted">
            <strong>注意：</strong><br />
            删除分类目录不会把该分类目录下的文章一并删除。文章会被归入<strong>默认</strong>分类目录。
        </p>
    </div>
</div>
<script type="text/javascript" src="/content/scripts/term.js"></script>
